#!/bin/bash
#1 = teacher account
#2 = folder
USAGE="Usage: $0 teacheraccount folder"

if [ $# -eq 1 ]
then 
if [ $1 -eq "--help" ]
then
  echo $USAGE
  exit 0
fi
fi

if [ $# -lt 2 ]
then 
echo $USAGE
exit 1
fi



if [ -d $2 ]
then 
#exists
echo ""
else 
echo "The directory doesn't exist!"
exit 1
fi
sudo groupadd -f teachers

RETURN=$?
if [ $RETURN -eq 0 ]
then
sudo chown $1:teachers $2

RETURNO=$?
sudo chmod 711 $2
RETURNT=$?
fi
if [ $RETURNO -ne 0 ]
then
echo "FOUT: $USAGE"
exit 1
fi
if [ $RETURNT -ne 0 ]
then
echo "FOUT: $USAGE"
exit 1
fi
exit 0
